home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / sticpsrc.lzh / SOURCE.ARC / SETLEVEL.S < prev    next >
Text File  |  1990-07-15  |  1KB  |  46 lines

  1. /
  2. / trap handler to allow user to enable/disable interrupts.
  3. / this trap handler will be installed by the ioinit() C routine. (atari.c)
  4. /
  5. / the desired processor priority level is passed as a parameter, and the
  6. / previous level will be returned in the lower 3 bits of D0
  7. /
  8. / adapted to non-68000 systems by testing the Atari-defined word _longframe
  9. / at 0x59e.  when it is nonzero we are running on a processor which pushes
  10. / an extra word (vector table offset) on the stack when handling exceptions.
  11. /
  12.     .globl    trap_x_
  13.     .shri
  14. trap_x_:
  15. /
  16. / get proper stack pointer to access argument
  17. /
  18.     movea.l usp,a0            / assume user stack for now
  19.     btst    $5,(sp)            / test for supervisor mode
  20.     beq.s    got_it            / no, so usp is the correct ptr
  21.     lea    6(sp),a0        / pt to arg on 68000 supervisor stack
  22.     move.w    0x59e,d0        / test the _longframe indicator
  23.     beq.s    got_it            / is a 68000, go
  24.     lea    8(sp),a0        / pt to arg on 680x0 (x != 0)
  25. got_it:
  26. /
  27. / get arg and move in position
  28. /
  29.     move.w    (a0),d0
  30.     lsl.w    $8,d0
  31. /
  32. / modify the status register on top of supervisor stack
  33. /
  34.     andi.w    $0xf8ff,(sp)        / clear the IPL bits
  35.     or.w    d0,(sp)            / insert the new value
  36. /
  37. / read current processor level and move to lower bits
  38. /
  39.     move.w    sr,d0
  40.     lsr.w    $8,d0
  41.     andi.w    $7,d0            / isolate the IPL bits
  42. /
  43. / "return from exception" will pop new processor level in SR
  44. /
  45.     rte
  46.